<?php
namespace App\Seeder;
use Predis\Client;

/**
 * 新增 快捷开始/便捷导航 菜单
 * Class AddNavigationSeeder
 */
class AddNavigationSeeder extends BaseSeeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $type = $this->data['type'];
        $wy_table_id = $this->data['wy_table_id'];
        $this->addNavigation($wy_table_id,$type);
    }

    /**
     * 新增导航
     * @param $wy_table_id
     * @param $type
     */
    public function addNavigation($wy_table_id,$type){
        $redis = new Client();
        switch ($type){
            case 1:// 小区
                $navicat = [
                    "数据总览=/xiaoqu/dashboard/analysis"
                    ,"工作台=/xiaoqu/dashboard/aa/ConsoleHtml"
                    ,"楼宇管理=/xiaoqu/CommunityManagement/BuildingManagement"
                    ,"房屋管理=/xiaoqu/CommunityManagement/HousingManagement"
                    ,"车位管理=/xiaoqu/CommunityManagement/ParkingSpaceManagement"
                    ,"车辆管理=/xiaoqu/CommunityManagement/VehicleManagement"
                    ,"住户管理=/xiaoqu/CommunityManagement/HouseholdManagement"
                    ,"基本设置=/xiaoqu/SystemManagement/BasicSettings"
                ];
                $redis->set('navicat_area'.$wy_table_id,json_encode($navicat));
                break;
            case 2:// 物业
                $navicat = [
                    "数据总览=/wuye/dashboard/analysis"
                    ,"工作台=/wuye/dashboard/aa/ConsoleHtml"
                    ,"小区列表=/wuye/community_management/community_management_list"
                    ,"收费管理=/wuye/PropertyFee/PFUtilityBill"
                    ,"角色管理=/wuye/EmployeeManagement/AuthorityManagement"
                    ,"基本设置=/wuye/SystemManagement/BasicSettings"
                ];
                $redis->set('navicat_property'.$wy_table_id,json_encode($navicat));
                break;
            case 3:// 运营商
                $navicat = [
                    "数据总览=/AdminOperatorsRouter/dashboard/PropertyCompanyA"
                    ,"工作台=/AdminOperatorsRouter/dashboard/ConsoleHtml"
                    ,"商家列表=/AdminOperatorsRouter/PropertyCompanyB/MerchantList"
                    ,"商家分类=/AdminOperatorsRouter/PropertyCompanyB/MerchantClassification"
                    ,"商品管理=/AdminOperatorsRouter/PropertyCompanyB/CommodityManagement"
                    ,"订单管理=/AdminOperatorsRouter/PropertyCompanyB/OrderManagement"
                ];
                $redis->set('navicat_operator'.$wy_table_id,json_encode($navicat));
                break;
        }
    }
}
